// miniprogram/pages/components/addsubfood/addsubfood.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    food_name:"",
    food_price:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  addSubFood(e){
    var that=this
      wx.request({
        url: 'https://thtl.vip/jishu/submitSubFood',
        method:"POST",
        'content-type': 'x-www-form-urlencoded;charset=utf-8',
        data:{
          name:"鸡蛋",
          price:that.data.food_price,
        },
        success:function(e){
         console.log(e.detail.value)
          if(e.detail.value=='success'){

          }
        }
      })
  },
  food_name_input(e){
    this.setData({
      food_name: e.detail.value
    })
  },
  deleSubFood(e){
    var that = this
    wx.request({
      url: 'https://thtl.vip/jishu/deleteSubFood',
      method: "POST",
      'content-type': 'x-www-form-urlencoded;charset=utf-8',
      data: {
        name: "鸡蛋",
        price: that.data.food_price,
      },
      success: function (e) {
        console.log(e.detail.value)
        if (e.detail.value == 'success') {

        }
      }
    })
  },
  food_price_input(e) {
    this.setData({
      food_price: e.detail.value
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})